package cn.com.wangluotongxin.chat.model.constants;

public enum FriendsApplyStatus {
    // 申请状态: 1.申请中 2.已同意 3.已拒绝 4.已取消
    RUNNING(1, "申请中"),
    AGREE(2, "已同意"),
    REJECTED(3, "已拒绝"),
    CANCEL(4, "已取消");

    private Integer code;

    public Integer getCode() {
        return code;
    }

    private String name;

    public String getName() {
        return name;
    }

    public static FriendsApplyStatus getByCode( Integer code){
        if(code == null){
            return null;
        }else {
            FriendsApplyStatus[] friendsApplyStatuses = values();
            for(FriendsApplyStatus friendsApplyStatus : friendsApplyStatuses){
                if(friendsApplyStatus.getCode().equals(code)){
                    return friendsApplyStatus;
                }
            }
        }
        return null;
    }

    FriendsApplyStatus(Integer code, String name){
        this.code = code;
        this.name = name;
    }
}
